﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.world {
    import flash.geom.*;
    import flash.utils.*;
    import net.wooga.pets.events.*;
    import __AS3__.vec.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class AbstractMoveCommand extends Command {

		[Inject]
        public var event:InfoEvent;
		[Inject]
        public var world:WorldModel;
		[Inject]
        public var roomSlotsModel:RoomSlotsModel;

        protected function getRoomBySlotId(_arg1:int, _arg2:Dictionary):IRoom{
            var _local3:IRoom;
            for each (_local3 in _arg2) {
                if (IRoom(_local3).slotId == _arg1){
                    return (_local3);
                };
            };
            return (null);
        }
        protected function getNextPosition(_arg1:int, _arg2:int):Vector.<Point>{
            var _local8:Point;
            var _local9:Point;
            var _local3:Number = (GameConstants.ROOM_HEIGHT - GameConstants.PATIENT_BOTTOM_OFFSET);
            var _local4:Slot = this.roomSlotsModel.getSlotById(_arg2);
            var _local5:Slot = this.roomSlotsModel.getSlotById(_arg1);
            var _local6:Vector.<Point> = new Vector.<Point>();
            var _local7:Point = _local4.position.clone();
            _local4.position.clone().y = (_local7.y + _local3);
            if (_local5.floor == _local4.floor){
                if (_local5.column > _local4.column){
                    _local7.x = (_local7.x + GameConstants.ROOM_WIDTH);
                };
            } else {
                _local8 = this.roomSlotsModel.getElevatorPos(_local5.floor);
                _local6.push(new Point(_local8.x, (_local5.position.y + _local3)));
                _local9 = this.roomSlotsModel.getElevatorPos(_local4.floor);
                _local6.push(new Point(_local9.x, (_local4.position.y + _local3)));
                if (_local4.column < RoomSlotsModel.ELEVATOR_BEFORE_COLOUMN){
                    _local7.x = (_local7.x + GameConstants.ROOM_WIDTH);
                };
            };
            _local6.push(_local7);
            return (_local6);
        }

    }
}//package net.wooga.pets.controllers.world 
